package com.liuwei.spring.cloud.junit;

import com.liuwei.spring.cloud.MyApplication;
import lombok.extern.slf4j.Slf4j;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@Slf4j
@ActiveProfiles("test")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = MyApplication.class)
public class BaseJunit {
    /**
     * 设置环境变量
     */
    static {
        System.setProperty("env", "test");
        System.setProperty("apollo.bootstrap.enabled", "true");
        System.setProperty("test_meta", "https://configserver.test-cz.lixiangoa.com");
        System.setProperty("app.id", "factory-wms-core-service");
        System.setProperty("eureka.client.register-with-eureka", "false");
        // 扫描全路径的 Mapper 文件, 防止 Junit 与 Mybatis 集成报异常
        System.setProperty("mybatis-plus.mapper-locations", "classpath*:**/*Mapper.xml");
    }
}
